package com.example.myapplication;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import com.example.myapplication.MainActivity;
import com.example.myapplication.MainActivity4x4;
import com.example.myapplication.MainActivity5x5;
import com.example.myapplication.R;

public class LevelSelectActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_level_select);

        Button level1Btn = findViewById(R.id.level_1_btn);
        Button level2Btn = findViewById(R.id.level_2_btn);
        Button level3Btn = findViewById(R.id.level_3_btn); // 新增按钮引用

        level1Btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 这里假设关卡 1 对应的是 MainActivity
                Intent intent = new Intent(LevelSelectActivity.this, MainActivity.class);
                startActivity(intent);
            }
        });

        level2Btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 这里假设关卡 2 对应的是 MainActivity4x4
                Intent intent = new Intent(LevelSelectActivity.this, MainActivity4x4.class);
                startActivity(intent);
            }
        });

        // 新增5x5关卡按钮点击事件
        level3Btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(LevelSelectActivity.this, MainActivity5x5.class);
                startActivity(intent);
            }
        });
    }
}